using System;
using System.Data;
using System.Collections.Generic;
using ADOBase;
namespace eTMS.DAO{
	/********************************BEGIN ChuongTrinhDaoTaoDAO****************************************/
	///<summary>
	/// <para>Author: Auto generated class by CSharp Code Generator v2.0</para>
	/// <para>Date:26/10/2011 34:05:09</para>
	/// <para>Class Name: ChuongTrinhDaoTaoDAO</para>
	/// <para>Description: Class access to table ChuongTrinhDaoTao in database. Coder should'nt code here.</para>
	///</summary>

	
	public partial class ChuongTrinhDaoTaoDAO : DAOBase<ChuongTrinhDaoTaoEntity>{


		#region Select functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateSelectOneCommand</para>
		/// <para>Input: ChuongTrinhDaoTao_ID</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectOneCommand(int ChuongTrinhDaoTao_ID){
			string strSQL="SELECT  [ChuongTrinhDaoTao_ID],[MaCTDaoTao],[TenCTDaoTao],[NgayTao],[GhiChu],[NganhHoc_ID],[LoaiHocPhi],[ChoPhepDangKy],[MacDinh] FROM [ChuongTrinhDaoTao]  WHERE [ChuongTrinhDaoTao].[ChuongTrinhDaoTao_ID]=@ChuongTrinhDaoTao_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",ChuongTrinhDaoTao_ID);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectOne</para>
		/// <para>Input: ChuongTrinhDaoTao_ID</para>
		/// <para>Output: ChuongTrinhDaoTaoEntity</para>
		///</summary>
		public ChuongTrinhDaoTaoEntity SelectOne(int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateSelectOneCommand(ChuongTrinhDaoTao_ID);
			return this.Select(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectOneByMaCTDaoTao</para>
		/// <para>Input: MaCTDaoTao</para>
		/// <para>Output: ChuongTrinhDaoTaoEntity</para>
		///</summary>
		public ChuongTrinhDaoTaoEntity SelectOneByMaCTDaoTao(string MaCTDaoTao){
			IDbCommand cmd=this.CreateSelectAllByKeyCommand("MaCTDaoTao",MaCTDaoTao);
			return this.Select(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectOneByMacDinh</para>
		/// <para>Input: MacDinh</para>
		/// <para>Output: ChuongTrinhDaoTaoEntity</para>
		///</summary>
		public ChuongTrinhDaoTaoEntity SelectOneByMacDinh(bool MacDinh){
			IDbCommand cmd=this.CreateSelectAllByKeyCommand("MacDinh",MacDinh);
			return this.Select(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateSelectAllCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllCommand(){
			string strSQL="SELECT  [ChuongTrinhDaoTao_ID],[MaCTDaoTao],[TenCTDaoTao],[NgayTao],[GhiChu],[NganhHoc_ID],[LoaiHocPhi],[ChoPhepDangKy],[MacDinh] FROM [ChuongTrinhDaoTao] ";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateSelectAllByKeyCommand</para>
		/// <para>Input: ColumnName,ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllByKeyCommand(string ColumnName,object Value){
			string strSQL="SELECT  [ChuongTrinhDaoTao_ID],[MaCTDaoTao],[TenCTDaoTao],[NgayTao],[GhiChu],[NganhHoc_ID],[LoaiHocPhi],[ChoPhepDangKy],[MacDinh] FROM [ChuongTrinhDaoTao]  WHERE [ChuongTrinhDaoTao].["+ColumnName+"]=@ColumnName";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectAll</para>
		/// <para>Input: </para>
		/// <para>Output: List of ChuongTrinhDaoTaoEntity</para>
		///</summary>
		public List<ChuongTrinhDaoTaoEntity> SelectAll(){
			IDbCommand cmd=this.CreateSelectAllCommand();
			return this.SelectList(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectAllDS</para>
		/// <para>Input: </para>
		/// <para>Output: DataSet</para>
		///</summary>
		public DataSet SelectAllDS(){
			IDbCommand cmd=this.CreateSelectAllCommand();
			return this.SelectDS(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateSelectAllFilterCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllFilterCommand(string strFilter){
			string strSQL="SELECT  [ChuongTrinhDaoTao_ID],[MaCTDaoTao],[TenCTDaoTao],[NgayTao],[GhiChu],[NganhHoc_ID],[LoaiHocPhi],[ChoPhepDangKy],[MacDinh] FROM [ChuongTrinhDaoTao]  WHERE "+RemoveInjection(strFilter);
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateSelectAllByKeyFilterCommand</para>
		/// <para>Input: ColumnName,ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllByKeyFilterCommand(string strFilter,string ColumnName,object Value){
			string strSQL="SELECT  [ChuongTrinhDaoTao_ID],[MaCTDaoTao],[TenCTDaoTao],[NgayTao],[GhiChu],[NganhHoc_ID],[LoaiHocPhi],[ChoPhepDangKy],[MacDinh] FROM [ChuongTrinhDaoTao]  WHERE [ChuongTrinhDaoTao].["+ColumnName+"]=@ColumnName AND "+RemoveInjection(strFilter);
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectAll</para>
		/// <para>Input: </para>
		/// <para>Output: List of ChuongTrinhDaoTaoEntity</para>
		///</summary>
		public List<ChuongTrinhDaoTaoEntity> SelectAllFilter(string strFilter){
			IDbCommand cmd=this.CreateSelectAllFilterCommand(strFilter);
			return this.SelectList(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SelectAllDSFilter</para>
		/// <para>Input: </para>
		/// <para>Output: DataSet</para>
		///</summary>
		public DataSet SelectAllDSFilter(string strFilter){
			IDbCommand cmd=this.CreateSelectAllFilterCommand(strFilter);
			return this.SelectDS(cmd);
		}
		#endregion

		#region Insert functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateInsertCommand</para>
		/// <para>Input: ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateInsertCommand(ChuongTrinhDaoTaoEntity o){
			string strSQL="INSERT INTO [ChuongTrinhDaoTao]([MaCTDaoTao],[TenCTDaoTao],[NgayTao],[GhiChu],[NganhHoc_ID],[LoaiHocPhi],[ChoPhepDangKy],[MacDinh]) VALUES  (@MaCTDaoTao,@TenCTDaoTao,@NgayTao,@GhiChu,@NganhHoc_ID,@LoaiHocPhi,@ChoPhepDangKy,@MacDinh);SELECT  @@IDENTITY";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullMaCTDaoTao)
				this.CreateCommandParameter(cmd,"@MaCTDaoTao",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MaCTDaoTao",o.MaCTDaoTao);

			if(o.IsNullTenCTDaoTao)
				this.CreateCommandParameter(cmd,"@TenCTDaoTao",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@TenCTDaoTao",o.TenCTDaoTao);

			if(o.IsNullNgayTao)
				this.CreateCommandParameter(cmd,"@NgayTao",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@NgayTao",o.NgayTao);

			if(o.IsNullGhiChu)
				this.CreateCommandParameter(cmd,"@GhiChu",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@GhiChu",o.GhiChu);

			if(o.IsNullNganhHoc_ID)
				this.CreateCommandParameter(cmd,"@NganhHoc_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@NganhHoc_ID",o.NganhHoc_ID);

			if(o.IsNullLoaiHocPhi)
				this.CreateCommandParameter(cmd,"@LoaiHocPhi",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@LoaiHocPhi",o.LoaiHocPhi);

			if(o.IsNullChoPhepDangKy)
				this.CreateCommandParameter(cmd,"@ChoPhepDangKy",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ChoPhepDangKy",o.ChoPhepDangKy);

			if(o.IsNullMacDinh)
				this.CreateCommandParameter(cmd,"@MacDinh",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MacDinh",o.MacDinh);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: Save</para>
		/// <para>Input: ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Save(ChuongTrinhDaoTaoEntity o){
			bool result=false;
			IDbCommand cmd=this.CreateInsertCommand(o);
			object id=this.ExecuteScalar(cmd,ref result);
			cmd.Dispose();
			try{
				o.ChuongTrinhDaoTao_ID=int.Parse(Convert.ToString(id));
			}
			catch{}
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: SaveList</para>
		/// <para>Input: List of ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: </para>
		///</summary>
		public void SaveList(List<ChuongTrinhDaoTaoEntity>list){
			foreach(ChuongTrinhDaoTaoEntity o in list){
				try{
					this.Save(o);
				}
				catch{
				}
			}
		}
		#endregion

		#region Update functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateUpdateCommand</para>
		/// <para>Input: ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: </para>
		///</summary>
		protected IDbCommand CreateUpdateCommand(ChuongTrinhDaoTaoEntity o){
			string strSQL="UPDATE  [ChuongTrinhDaoTao] SET [ChuongTrinhDaoTao].[MaCTDaoTao]=@MaCTDaoTao,[ChuongTrinhDaoTao].[TenCTDaoTao]=@TenCTDaoTao,[ChuongTrinhDaoTao].[NgayTao]=@NgayTao,[ChuongTrinhDaoTao].[GhiChu]=@GhiChu,[ChuongTrinhDaoTao].[NganhHoc_ID]=@NganhHoc_ID,[ChuongTrinhDaoTao].[LoaiHocPhi]=@LoaiHocPhi,[ChuongTrinhDaoTao].[ChoPhepDangKy]=@ChoPhepDangKy,[ChuongTrinhDaoTao].[MacDinh]=@MacDinh WHERE [ChuongTrinhDaoTao].[ChuongTrinhDaoTao_ID]=@ChuongTrinhDaoTao_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullChuongTrinhDaoTao_ID)
				this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",o.ChuongTrinhDaoTao_ID);

			if(o.IsNullMaCTDaoTao)
				this.CreateCommandParameter(cmd,"@MaCTDaoTao",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MaCTDaoTao",o.MaCTDaoTao);

			if(o.IsNullTenCTDaoTao)
				this.CreateCommandParameter(cmd,"@TenCTDaoTao",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@TenCTDaoTao",o.TenCTDaoTao);

			if(o.IsNullNgayTao)
				this.CreateCommandParameter(cmd,"@NgayTao",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@NgayTao",o.NgayTao);

			if(o.IsNullGhiChu)
				this.CreateCommandParameter(cmd,"@GhiChu",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@GhiChu",o.GhiChu);

			if(o.IsNullNganhHoc_ID)
				this.CreateCommandParameter(cmd,"@NganhHoc_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@NganhHoc_ID",o.NganhHoc_ID);

			if(o.IsNullLoaiHocPhi)
				this.CreateCommandParameter(cmd,"@LoaiHocPhi",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@LoaiHocPhi",o.LoaiHocPhi);

			if(o.IsNullChoPhepDangKy)
				this.CreateCommandParameter(cmd,"@ChoPhepDangKy",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ChoPhepDangKy",o.ChoPhepDangKy);

			if(o.IsNullMacDinh)
				this.CreateCommandParameter(cmd,"@MacDinh",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MacDinh",o.MacDinh);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateUpdateFieldCommand</para>
		/// <para>Input: ColumnName,ColumnValue,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateUpdateFieldCommand(string ColumnName,object Value,int ChuongTrinhDaoTao_ID){
			string strSQL="UPDATE  [ChuongTrinhDaoTao] SET [ChuongTrinhDaoTao].["+ColumnName+"]=@ColumnName WHERE [ChuongTrinhDaoTao].[ChuongTrinhDaoTao_ID]=@ChuongTrinhDaoTao_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",ChuongTrinhDaoTao_ID);



			this.CreateCommandParameter(cmd,"@ColumnName",Value);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: Update</para>
		/// <para>Input: ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Update(ChuongTrinhDaoTaoEntity o){
			IDbCommand cmd=this.CreateUpdateCommand(o);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateList</para>
		/// <para>Input: List of ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: </para>
		///</summary>
		public void UpdateList(List<ChuongTrinhDaoTaoEntity>list){
			foreach(ChuongTrinhDaoTaoEntity o in list){
				try{
					this.Update(o);
				}
				catch{
				}
			}
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateMaCTDaoTao</para>
		/// <para>Input: NewMaCTDaoTao,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateMaCTDaoTao(string NewMaCTDaoTao,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("MaCTDaoTao",NewMaCTDaoTao,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateTenCTDaoTao</para>
		/// <para>Input: NewTenCTDaoTao,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateTenCTDaoTao(string NewTenCTDaoTao,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("TenCTDaoTao",NewTenCTDaoTao,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateNgayTao</para>
		/// <para>Input: NewNgayTao,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateNgayTao(DateTime NewNgayTao,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("NgayTao",NewNgayTao,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateGhiChu</para>
		/// <para>Input: NewGhiChu,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateGhiChu(string NewGhiChu,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("GhiChu",NewGhiChu,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateNganhHoc_ID</para>
		/// <para>Input: NewNganhHoc_ID,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateNganhHoc_ID(int NewNganhHoc_ID,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("NganhHoc_ID",NewNganhHoc_ID,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateLoaiHocPhi</para>
		/// <para>Input: NewLoaiHocPhi,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateLoaiHocPhi(Byte NewLoaiHocPhi,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("LoaiHocPhi",NewLoaiHocPhi,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateChoPhepDangKy</para>
		/// <para>Input: NewChoPhepDangKy,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateChoPhepDangKy(bool NewChoPhepDangKy,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("ChoPhepDangKy",NewChoPhepDangKy,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: UpdateMacDinh</para>
		/// <para>Input: NewMacDinh,ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateMacDinh(bool NewMacDinh,int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateUpdateFieldCommand("MacDinh",NewMacDinh,ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		#endregion

		#region Delete functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: DeleteAllCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteAllCommand(){
			string strSQL="DELETE   FROM [ChuongTrinhDaoTao]  ";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: DeleteCommand</para>
		/// <para>Input: ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteCommand(ChuongTrinhDaoTaoEntity o){
			string strSQL="DELETE   FROM [ChuongTrinhDaoTao]   WHERE [ChuongTrinhDaoTao].[ChuongTrinhDaoTao_ID]=@ChuongTrinhDaoTao_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullChuongTrinhDaoTao_ID)
				this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",o.ChuongTrinhDaoTao_ID);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: DeleteAll</para>
		/// <para>Input: </para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool DeleteAll(){
			IDbCommand cmd=this.CreateDeleteAllCommand();
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateDeleteByPrimaryKeyCommand</para>
		/// <para>Input: ChuongTrinhDaoTao_ID</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteByPrimaryKeyCommand(int ChuongTrinhDaoTao_ID){
			string strSQL="DELETE   FROM [ChuongTrinhDaoTao]   WHERE [ChuongTrinhDaoTao].[ChuongTrinhDaoTao_ID]=@ChuongTrinhDaoTao_ID";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ChuongTrinhDaoTao_ID",ChuongTrinhDaoTao_ID);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: CreateDeleteByKeyCommand</para>
		/// <para>Input: ColumnName , ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteByKeyCommand(string ColumnName,object Value){
			string strSQL="DELETE   FROM [ChuongTrinhDaoTao]   WHERE [ChuongTrinhDaoTao].["+ColumnName+"]=@ColumnName";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: Delete</para>
		/// <para>Input: ChuongTrinhDaoTaoEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Delete(ChuongTrinhDaoTaoEntity o){
			IDbCommand cmd=this.CreateDeleteCommand(o);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: DeleteByID</para>
		/// <para>Input: ChuongTrinhDaoTao_ID</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool DeleteByID(int ChuongTrinhDaoTao_ID){
			IDbCommand cmd=this.CreateDeleteByPrimaryKeyCommand(ChuongTrinhDaoTao_ID);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		#endregion

		#region Select join to NganhHoc functions
		#endregion

		#region Select,delete by ChuongTrinhDaoTao_ID functions
		#endregion

		#region Select,delete by NganhHoc_ID functions
		#endregion

		#region MapObject functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:26/10/2011 34:05:09</para>
		/// <para>Name: MapObject</para>
		/// <para>Input: IDataReader</para>
		/// <para>Output: ChuongTrinhDaoTaoEntity</para>
		///</summary>
		protected override ChuongTrinhDaoTaoEntity MapObject(IDataReader r){
			ChuongTrinhDaoTaoEntity entity = new ChuongTrinhDaoTaoEntity();
			try{
				if(r.FieldCount>0){
					try
					{
						int ordinal = r.GetOrdinal("ChuongTrinhDaoTao_ID");
						if (!r.IsDBNull(ordinal)) entity.ChuongTrinhDaoTao_ID = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("MaCTDaoTao");
						if (!r.IsDBNull(ordinal)) entity.MaCTDaoTao = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("TenCTDaoTao");
						if (!r.IsDBNull(ordinal)) entity.TenCTDaoTao = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("NgayTao");
						if (!r.IsDBNull(ordinal)) entity.NgayTao = ((DateTime)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("GhiChu");
						if (!r.IsDBNull(ordinal)) entity.GhiChu = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("NganhHoc_ID");
						if (!r.IsDBNull(ordinal)) entity.NganhHoc_ID = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("LoaiHocPhi");
						if (!r.IsDBNull(ordinal)) entity.LoaiHocPhi = ((Byte)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("ChoPhepDangKy");
						if (!r.IsDBNull(ordinal)) entity.ChoPhepDangKy = ((bool)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("MacDinh");
						if (!r.IsDBNull(ordinal)) entity.MacDinh = ((bool)(r.GetValue(ordinal)));
					}
					catch{}
					return entity;
				}
			}catch{}
			return null;
		}
		#endregion
	}
	/*****************************************************************************************************/
	/**********************************END ChuongTrinhDaoTaoDAOBase*****************************************/
	/*****************************************************************************************************/
}

